using UnityEngine;
using System.Collections;

public class UIPlayerInfo : MonoBehaviour
{
	public UISprite playerPicSprite;
	public UILabel playerNameLabel;
	public UILabel vipLevelLabel;
	public UILabel goldsNumberLabel;
	public UILabel coinsNumberLabel;
	public UISprite energySprite;
	public UILabel energyLabel;
	public UILabel levelLabel;
	public UILabel fightValueLabel;
	
	string mPlayerPicName;
	string mPlayerName;
	int mVipLevel;
	int mGolds;
	int mCoins;
	int mEnergy;
	int mLevel;
	int mFightValue;
	
	void Awake(){
		
	}
	
	void Start ()
	{
		//Get player's data
		//mPlayerName = CreateRoleInfo.GetInstance().PlayerName;
		
		
		playerPicSprite.spriteName = ModelLocator.getInstance().scene.Role.GetProperties("HeadPic").ToString();
		playerNameLabel.text = ModelLocator.getInstance().scene.Role.GetProperties("RoleName").ToString();
		
		if(vipLevelLabel != null) {
			RefreshVipLevel(0);
		}
		
		//levelLabel.text = GameDefine.LVSTRING + ModelLocator.getInstance().scene.Role.GetProperties("Level").ToString();
		
		//TODO
		vipLevelLabel.text = "Vip" + 0;
		
		goldsNumberLabel.text = "0";
		
		coinsNumberLabel.text = "0";
		
		energyLabel.text = "2000/2000";
		
		BindManage.getInstance().BindProp(ModelLocator.getInstance ().scene.Role, "Level", this, "LevelUp");
		//if(goldsNumberLabel != null)
	}
	
	void Update ()
	{
		
	}
	
	public void RefreshVipLevel(int vipLevel){
		mVipLevel += vipLevel;
		string sVipLevel = "vip" + mVipLevel.ToString();
		vipLevelLabel.text = sVipLevel;
	}
	
	public void RefreshGoldsNumber(int goldNum){
		mGolds += goldNum;
	}
	
	public void LevelUp(object proName,object proValue){
		levelLabel.text = "Lv." + proValue.ToString();
	}
}
